package cn.biwysh.exam.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import cn.biwysh.exam.biz.NoticeBiz;
import cn.biwysh.exam.entity.Notice;
import cn.biwysh.exam.entity.User;

public class Index extends HttpServlet {

	private static final long serialVersionUID = 1L;

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException
	{
//		HttpSession session = request.getSession(false);
//		if (session != null)
//		{
//			User vUser = null;
//			if (session.getAttribute("user") != null) {
//				vUser = (User) session.getAttribute("user");
//				if (vUser != null) {
//					
//				}
//			}
//		}
		NoticeBiz nbiz=new NoticeBiz();
		List<Notice> imglist=nbiz.GetNoticeByPage(" and type=2", 1, 6);
		List<Notice> guo=nbiz.GetNoticeByPage(" and type=1 and kind=1 ", 1, 8);
		List<Notice> sheng=nbiz.GetNoticeByPage(" and type=1 and kind=2 ", 1, 8);
		List<Notice> shi=nbiz.GetNoticeByPage(" and type=1 and kind=3 ", 1, 8);
		request.setAttribute("imglist", imglist);
		request.setAttribute("guo", guo);
		request.setAttribute("sheng", sheng);
		request.setAttribute("shi", shi);
		String url="WEB-INF/jsp/index.jsp";
		response.setContentType("text/html");
		RequestDispatcher requestDispatcher = request.getRequestDispatcher(url);
		requestDispatcher.forward(request, response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException
	{
      this.doGet(request, response);
	}

}
